/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.entity;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.xcxAdmin.entity.ZtAdmin;

/**   
 * 测试数据Entity
 * 
 * @author ThinkGem
 * @version 2018-04-22
 */
@Table(name = "zt_goods_order", alias = "a", columns = {
		@Column(name = "id", attrName = "id", label = "编号", isPK = true),
		@Column(name = "order", attrName = "order", label = "订单号", queryType = QueryType.LIKE),
		@Column(name = "addr", attrName = "addr", label = "地址", queryType = QueryType.LIKE),
		@Column(name = "phone", attrName = "phone", label = "手机号码", queryType = QueryType.LIKE),
		@Column(name = "name", attrName = "name", label = "收货人", queryType = QueryType.LIKE),
		@Column(name = "balance", attrName = "balance", label = "余额"),
		@Column(name = "logistics", attrName = "logistics", label = "物流单号"),
		@Column(name = "logistics_name", attrName = "logisticsName", label = "物流名"),
		@Column(name = "logistics_code", attrName = "logisticsCode", label = "物流公司代号"),
		@Column(name = "order_time", attrName = "orderTime", label = "下单时间"),
		@Column(name = "pay_time", attrName = "payTime", label = "支付时间", isUpdate = true),
		
		@Column(name = "create_date", attrName = "createDate", label = "创建时间"),
		@Column(name = "freight", attrName = "freight", label = "运费"),  
		
		@Column(name = "total_price", attrName = "totalPrice", label = "总付款金额"),
		@Column(name = "num_count", attrName = "numCount", label = "数量"),

		@Column(name = "goodsid", attrName = "ztGoods.id", label = "商品id值"),
		@Column(name = "remaining_time", attrName = "remainingTime", label = "剩余时间"),
		@Column(name = "issue_time", attrName = "issueTime", label = "妥投时间"),
		@Column(name = "province", attrName = "province", label = "收货人"),
		@Column(name = "city", attrName = "city", label = "收货人"),
		@Column(name = "county", attrName = "county", label = "收货人"),
		@Column(name = "town", attrName = "town", label = "收货人"),
		@Column(name = "townbid", attrName = "townbid", label = "收货人"),
		@Column(name = "countybid", attrName = "countybid", label = "收货人"),
		@Column(name = "provincebid", attrName = "provincebid", label = "收货人"),
		@Column(name = "citybid", attrName = "citybid", label = "收货人"),
		@Column(name = "detailaddr", attrName = "detailaddr", label = "收货人"),
		@Column(name = "state", attrName = "state", label = "1妥投 2拒收"),
		@Column(name = "status", attrName = "status", label = "状态"),
		@Column(name = "orderstatus", attrName = "orderstatus", label = "订单状态"),
		@Column(name = "goods_price", attrName = "goodsPrice", label = "商品单价"),
		@Column(name = "issign", attrName = "issign", label = "拣货标识"),
		
		@Column(name = "spotid", attrName = "spotid", label = "渠道"),
		@Column(name = "isjs", attrName = "isjs", label = "佣金是否结算"),
		
		@Column(name = "channelorder", attrName = "channelorder", label = "渠道订单号"),
		@Column(name = "channelprice", attrName = "channelprice", label = "渠道价"),
		@Column(name = "sku", attrName = "sku", label = "商品编号"),
		@Column(name = "channel_porder", attrName = "channelPorder", label = "渠道订单号主订单"),
		@Column(name = "admin_id", attrName = "ztAdmin.id", label = "小程序用户id"),
		@Column(name = "specificationsid", attrName = "specificationsid", label = "规格id"),
		@Column(name = "colorid", attrName = "colorid", label = "颜色id"),
		@Column(name = "salestatus", attrName = "salestatus", label = "售后状态,1已完成，2申请中，3已退款，4已取消，5已换货，6已维修")

}, joinTable = { @JoinTable(type = Type.LEFT_JOIN, entity = ZtAdmin.class, attrName = "ztAdmin", alias = "u10", on = "u10.id = a.admin_id", columns = {
		@Column(name = "name", label = "小程序用户名", queryType = QueryType.LIKE),
		@Column(name = "headimgurl", label = "小程序头像", attrName = "headimgurl"), }),
		@JoinTable(type = Type.LEFT_JOIN, entity = ZtGoods.class, attrName = "ztGoods", alias = "z", on = "z.id = a.goodsid", columns = {
			@Column(name = "title", label = "商品名", queryType = QueryType.LIKE),
			@Column(name = "img", label = "商品图", attrName = "img"), })

}, orderBy = "a.create_date DESC")
public class ZtGoodsOrder extends DataEntity<ZtGoodsOrder> implements Comparator<Object>{

	private static final long serialVersionUID = 199L;
	private ZtGoods ztGoods;
	private Integer spotid;//渠道  0是自购    1京东
	private String order, addr, phone, name, logistics, logisticsName, type,
			status, orderstatus,issign,salestatus;

	private Date orderTime; //订单时间
	private Date payTime; //付款时间
	private Date remainingTime;//佣金结算时间
	private Integer isjs;//佣金是否结算   0没有结算    1已经结算  
	
	private String state;//1是妥投，2是拒收   
	private Double origPrice;//商品总计
	private String channelorder;
	private String sku;
	private Double channelprice;//渠道价
	private String channelPorder;
	private Double totalPrice, //应付总价
	
	goodsPrice;//商品单价
	private Double balance;//余额
	private Double freight;//运费
	
	private String specificationsid;//规格id
	private String colorid;//颜色id
	
	private ZtAdmin ztAdmin;
	
	private Integer numCount;//数量

	private String logisticsCode;
	
	private Date issueTime;//妥投时间
	
	private String colorName;//颜色值
	private String guigeName;//规格值
	
	private String province;
	private String city;
	private String county;
	private String detailaddr;
	
	private String town;
	private Integer townbid;
	private Integer countybid;
	private Integer provincebid;
	private Integer citybid;
	
	
	public Double getOrigPrice() {
		return origPrice;
	}

	public void setOrigPrice(Double origPrice) {
		this.origPrice = origPrice;
	}

	public Integer getIsjs() {
		return isjs;
	}

	public void setIsjs(Integer isjs) {
		this.isjs = isjs;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getChannelorder() {
		return channelorder;
	}

	public void setChannelorder(String channelorder) {
		this.channelorder = channelorder;
	}

	public String getSku() {
		return sku;
	}

	public void setSku(String sku) {
		this.sku = sku;
	}

	public Double getChannelprice() {
		return channelprice;
	}

	public void setChannelprice(Double channelprice) {
		this.channelprice = channelprice;
	}

	public Integer getSpotid() {
		return spotid;
	}

	public void setSpotid(Integer spotid) {
		this.spotid = spotid;
	}

	public String getDetailaddr() {
		return detailaddr;
	}

	public void setDetailaddr(String detailaddr) {
		this.detailaddr = detailaddr;
	}

	public String getChannelPorder() {
		return channelPorder;
	}

	public void setChannelPorder(String channelPorder) {
		this.channelPorder = channelPorder;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getTown() {
		return town;
	}

	public void setTown(String town) {
		this.town = town;
	}

	public Integer getTownbid() {
		return townbid;
	}

	public void setTownbid(Integer townbid) {
		this.townbid = townbid;
	}

	public Integer getCountybid() {
		return countybid;
	}

	public void setCountybid(Integer countybid) {
		this.countybid = countybid;
	}

	public Integer getProvincebid() {
		return provincebid;
	}

	public void setProvincebid(Integer provincebid) {
		this.provincebid = provincebid;
	}

	public Integer getCitybid() {
		return citybid;
	}

	public void setCitybid(Integer citybid) {
		this.citybid = citybid;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCounty() {
		return county;
	}

	public void setCounty(String county) {
		this.county = county;
	}

	public String getColorName() {
		return colorName;
	}

	public void setColorName(String colorName) {
		this.colorName = colorName;
	}

	public String getSalestatus() {
		return salestatus;
	}

	public void setSalestatus(String salestatus) {
		this.salestatus = salestatus;
	}

	public String getGuigeName() {
		return guigeName;
	}

	public void setGuigeName(String guigeName) {
		this.guigeName = guigeName;
	}

	public String getSpecificationsid() {
		return specificationsid;
	}

	public void setSpecificationsid(String specificationsid) {
		this.specificationsid = specificationsid;
	}

	public String getColorid() {
		return colorid;
	}

	public void setColorid(String colorid) {
		this.colorid = colorid;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	public Double getFreight() {
		return freight;
	}

	public void setFreight(Double freight) {
		this.freight = freight;
	}

	public String getIssign() {
		return issign;
	}

	public void setIssign(String issign) {
		this.issign = issign;
	}

	public Double getGoodsPrice() {
		return goodsPrice;
	}

	public void setGoodsPrice(Double goodsPrice) {
		this.goodsPrice = goodsPrice;
	}

	public String getLogisticsCode() {
		return logisticsCode;
	}

	public void setLogisticsCode(String logisticsCode) {
		this.logisticsCode = logisticsCode;
	}

	public ZtGoods getZtGoods() {
		return ztGoods;
	}

	public void setZtGoods(ZtGoods ztGoods) {
		this.ztGoods = ztGoods;
	}

	@JsonIgnore
	private Date createDate;
	@JsonIgnore
	private String updateBy;
	@JsonIgnore
	private String createBy;
	@JsonIgnore
	private Date updateDate;

	private Integer pageNum;

	private List<ZtQuan> ztQuanselfList = new ArrayList<ZtQuan>();
	private List<ZtGoods> ztGoodsList = new ArrayList<ZtGoods>();

	@JsonIgnore
	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public List<ZtQuan> getZtQuanselfList() {
		return ztQuanselfList;
	}

	public void setZtQuanselfList(List<ZtQuan> ztQuanselfList) {
		this.ztQuanselfList = ztQuanselfList;
	}

	public List<ZtGoods> getZtGoodsList() {
		return ztGoodsList;
	}

	public void setZtGoodsList(List<ZtGoods> ztGoodsList) {
		this.ztGoodsList = ztGoodsList;
	}

	public String getOrderstatus() {
		return orderstatus;
	}

	public void setOrderstatus(String orderstatus) {
		this.orderstatus = orderstatus;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public String getAddr() {
		return addr;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLogistics() {
		return logistics;
	}

	public void setLogistics(String logistics) {
		this.logistics = logistics;
	}

	public String getLogisticsName() {
		return logisticsName;
	}

	public void setLogisticsName(String logisticsName) {
		this.logisticsName = logisticsName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(Date orderTime) {
		this.orderTime = orderTime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getPayTime() {
		return payTime;
	}

	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreateDate() {
		return createDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getIssueTime() {
		return issueTime;
	}

	public void setIssueTime(Date issueTime) {
		this.issueTime = issueTime;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getRemainingTime() {
		return remainingTime;
	}

	public void setRemainingTime(Date remainingTime) {
		this.remainingTime = remainingTime;
	}

	public Double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}

	public ZtAdmin getZtAdmin() {
		return ztAdmin;
	}

	public void setZtAdmin(ZtAdmin ztAdmin) {
		this.ztAdmin = ztAdmin;
	}

	public Integer getNumCount() {
		return numCount;
	}

	public void setNumCount(Integer numCount) {
		this.numCount = numCount;
	}

	public int compare(Object obj0, Object obj1) {
		String time0="";
		String time1="";
		if(obj0 instanceof ZtGoodsOrder){
			time0=((ZtGoodsOrder) obj0).getOrderTime().toString();
		
		}else if(obj0 instanceof ZtOrder){
			time0=((ZtOrder) obj0).getOrderTime().toString();
		}
		
		if(obj1 instanceof ZtGoodsOrder){
			time1=((ZtGoodsOrder) obj1).getOrderTime().toString();
		
		}else if(obj1 instanceof ZtOrder){
			time1=((ZtOrder) obj1).getOrderTime().toString();
		}
		int flag = time0.compareTo(time1);
		return -flag; // 不取反，则按正序排列
		

	}
	

}